package com.woniu.product.controller;

import com.woniu.common.utils.ResponseData;
import com.woniu.product.pojo.ZyProduct;
import com.woniu.product.service.ShoppingCartService;
import com.woniu.product.service.ZyProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

@RestController
public class ShoppingCartController {
    @Autowired
    private ShoppingCartService addShoppingCart;
    @PostMapping("/addShoppingCart")
    public ResponseData<?> addShoppingCart(@RequestBody ZyProduct product) {
        try {
            return addShoppingCart.addShoppingCart(product);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
    @GetMapping("/selectShoppingCartList")
    public ResponseData<?> selectShoppingCartList() {
        try {
            return addShoppingCart.selectShoppingCartList();
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
}
